package io.renren.modules.empla.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.empla.entity.EmployeelableEntity;
import io.renren.modules.empla.service.EmployeelableService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-08-04 14:39:25
 */
@RestController
@RequestMapping("empla/employeelable")
public class EmployeelableController {
    @Autowired
    private EmployeelableService employeelableService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("empla:employeelable:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = employeelableService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{employeeNo}")
    @RequiresPermissions("empla:employeelable:info")
    public R info(@PathVariable("employeeNo") Integer employeeNo){
		EmployeelableEntity employeelable = employeelableService.getById(employeeNo);

        return R.ok().put("employeelable", employeelable);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("empla:employeelable:save")
    public R save(@RequestBody EmployeelableEntity employeelable){
		employeelableService.save(employeelable);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("empla:employeelable:update")
    public R update(@RequestBody EmployeelableEntity employeelable){
		employeelableService.updateById(employeelable);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("empla:employeelable:delete")
    public R delete(@RequestBody Integer[] employeeNos){
		employeelableService.removeByIds(Arrays.asList(employeeNos));

        return R.ok();
    }

}
